<?php
function is_mobile() {
    $user_agent = $_SERVER['HTTP_USER_AGENT'];
    $mobile_browser = Array(
    "mqqbrowser","opera mobi","juc","iuc",
    "fennec","ios","applewebKit/420","applewebkit/525","applewebkit/532","ipad","iphone","ipaq","ipod",
    "iemobile", "windows ce",
    "240×320","480×640","acer","android","anywhereyougo.com","asus","audio","blackberry","blazer","coolpad" ,"dopod", "etouch", "hitachi","htc","huawei", "jbrowser", "lenovo","lg","lg-","lge-","lge", "mobi","moto","nokia","phone","samsung","sony","symbian","tablet","tianyu","wap","xda","xde","zte"
    );
    $is_mobile = false;
    foreach ($mobile_browser as $device) {
        if (stristr($user_agent, $device)) {
            $is_mobile = true;
            break;
        }
    }
    return $is_mobile;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>后台管理系统</title>
    <link rel="stylesheet" href="index.css">
</head>
<body>
    <div class="container">
        <div class="head">
            <div class="title"><a href="#">后台管理系统</a></div>
            <div class="quit"><a href="quit.php" class="text-center">退出</a></div>
        </div>
        <div class="main">
            <div class="main-left off">
                <ul>
                    <?php if(is_mobile()){ ?>
                        <li><a href="user_list.php" target="open-page">聊天窗口</a></li>
                    <?php }else{ ?>
                        <li><a href="pc.php" target="open-page">聊天窗口</a></li> 
                    <?php } ?>
                    <li><a href="msg.php" target="open-page">聊天内容</a></li>
                    <li><a href="reply.php" target="open-page">快捷回复</a></li>
                    <li><a href="member.php" target="open-page">访客列表</a></li>
                    <li><a href="login_log.php" target="open-page">登录记录</a></li>
                    <li><a href="edit_info.php" target="open-page">账号管理</a></li>
                    <li><a href="goods.php" target="open-page">商品管理</a></li>
                </ul>
            </div>
            <div class="main-right">
                <?php if(is_mobile()){ ?>
                    <iframe src="user_list.php" name="open-page" frameborder="0" width="100%" height="100%"></iframe>
                <?php }else{ ?>
                    <iframe src="pc.php" name="open-page" frameborder="0" width="100%" height="100%"></iframe>
                <?php } ?>
                
            </div>
        </div>
        <div class="kg">
            <span id="off" class="off">◀️</span>
            <span id="on"  >▶️</span>
        </div>
    </div>
    <script>
        window.onload = function(){
            document.querySelector("#off").onclick = function(){
                document.querySelector(".main-left").classList.add("off"); 
                document.querySelector("#off").classList.toggle("off"); 
                document.querySelector("#on").classList.toggle("off"); 
            }
            document.querySelector("#on").onclick = function(){
               document.querySelector(".main-left").classList.remove("off"); 
               document.querySelector("#off").classList.toggle("off"); 
               document.querySelector("#on").classList.toggle("off"); 
            }
        }
    </script>
</body>
</html>